{% extends 'base.html' %}
{% load template_helper %}

{% block title %}兑换 {{ gift.name }}{% endblock %}

{% block body %}
<div class="am-container">
<div class="am-g">
  <div class="am-u-sm-centered am-u-sm-11">
      <h3>兑换 “{{ gift.name }}”</h3>
      <p>价格： <span class="am-text-danger"><strong>{{ gift.price }}</strong></span> 金币，现有金币数： <span class="am-text-danger"><strong>{{ request.user.coin }}</strong></span> 个</p>
      <hr>
      <form class="am-form form-confirm" method="post" id="postform" enctype="multipart/form-data">
          <fieldset>
            {% for field in form %}
                    <div class="am-form-group am-form-group-sm">
                    <label>{{ field.label }} &nbsp;
                    <small>
                        {% if field.errors %}
                        <span class="am-text-danger">{{ field.errors | first}}</span>
                        {% endif %}
                    </small></label>
                        {{ field | css:"am-form-field" | placeholder:field.help_text }}
                    </div>
            {% endfor %}
          </fieldset>
      {% csrf_token %}
        <div class="am-btn-group am-fr am-margin-right-lg am-margin-top">
          <a href="{% url 'archive:gift' pk=gift.id %}" class="am-btn am-btn-default">返回</a>
          <button type="submit" class="am-btn am-btn-primary">购买</button>
        </div>
      </form>
  </div>
</div>
</div>
{% endblock %}